﻿namespace iStudio.Structure.Command
{
    public class ModuleCommandType
    {
        public string Id
        {
            get;
            set;
        }

        public static ModuleCommandType FromCommandId (string id)
        {
            return new ModuleCommandType
                       {
                           Id = id
                       };
        }

        public static bool operator == (ModuleCommandType a, ModuleCommandType b)
        {
            if (a.Id == b.Id)
            {
                return true;
            }

            return false;
        }

        public static bool operator != (ModuleCommandType a, ModuleCommandType b)
        {
            return !(a == b);
        }

        public bool Equals (ModuleCommandType other)
        {
            if (ReferenceEquals (null, other))
            {
                return false;
            }
            if (ReferenceEquals (this, other))
            {
                return true;
            }
            return Equals (other.Id, Id);
        }

        public override bool Equals (object obj)
        {
            if (ReferenceEquals (null, obj))
            {
                return false;
            }
            if (ReferenceEquals (this, obj))
            {
                return true;
            }
            if (obj.GetType () != typeof (ModuleCommandType))
            {
                return false;
            }
            return Equals ((ModuleCommandType) obj);
        }

        public override int GetHashCode ()
        {
            return (Id != null ? Id.GetHashCode () : 0);
        }
    }
}
